<include file="Public/header" title="添加单页" />
<div id="page-wrapper">

    <form method="post" action="{:U('lunbo/update')}" id="myform"  role="form" class="form-signin" enctype="multipart/form-data">
        <div class="form-group ">
            <input type="hidden" name="id" value="{$page.id}">
            <label for="title">图片标题</label>
            <input type="text" name="title" class="form-control"  id="title" value="{$page.title}">
        </div>
        <div class="form-group">
            <label >类型</label>
            <br>
            <label class="radio-inline">
                <input type="radio" name="type"  value="1" <if condition="$page.type eq 1">checked="checked"</if>>APP首页轮播图
            </label>
            <label class="radio-inline">
                <input type="radio" name="type"  value="2"<if condition="$page.type eq 2">checked="checked"</if>  >APP广告位
            </label>
        </div>


        <div class="form-group">
            <label for="url">url链接</label>
            <input type="text" name="url" class="form-control" id="url"  value="{$page.url}">
        </div>
        <div class="form-group">
            <label for="img" >上传图片:</label>&nbsp;需要更新就添加,不更新不添加
            <input type="file" class="form-control" id="img" name="file" value="">
        </div>



        <button type="submit" class="btn btn-default">提交</button>
    </form>
</div>
<script>
    $('#myform').bootstrapValidator({
        message: '值不能为空',
        excluded:[":disabled"],//关键配置，表示只对于禁用域不进行验证，其他的表单元素都要验证
        feedbackIcons: {//验证成功或失败的样式
//                valid: 'glyphicon glyphicon-ok',
//                invalid: 'glyphicon glyphicon-remove',
//                validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            title: {
                validators: {
                    notEmpty: {
                        message: '图片标题必须填写'
                    }
                }
            },
            img: {
                validators: {
                    notEmpty: {
                        message: '图片必须选择'
                    }
                }

            }

        }
    }).on('success.form.bv', function(e) { //验证全部符合点击提交之后
        return true;
    });

</script>




<include file="Public/footer" />